﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StaticFieldsTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Parallel.For(0, 500000, new ParallelOptions() { MaxDegreeOfParallelism = 1000 }, i =>
            {
                var t = AppSetting.ESBUserID

;
                Console.WriteLine(i + t);
            }
                );
        }
    }

    #region AppSetting配置文件
    /// <summary>
    /// 获取AppSetting中的配置信息
    /// </summary>
    public class AppSetting
    {
        #region app
        /// <summary>
        /// 应用程序编号
        /// </summary>
        public static string AppID = ConfigurationManager.AppSettings["AppID"] == null ? "" : ConfigurationManager.AppSettings["AppID"];
        /// <summary>
        /// ESB 地址  
        /// </summary>
        public static string ESBUrl = ConfigurationManager.AppSettings["ESBUrl"] == null ? "" : ConfigurationManager.AppSettings["ESBUrl"];
        /// <summary>
        /// ESB UserID
        /// </summary>
        public static string ESBUserID = ConfigurationManager.AppSettings["ESBUserID"] == null ? "" : ConfigurationManager.AppSettings["ESBUserID"];

        /// <summary>
        /// API2.0 分销联盟用户ID
        /// </summary>
        public static string AllianceID = ConfigurationManager.AppSettings["AllianceID"] == null ? "" : ConfigurationManager.AppSettings["AllianceID"];
        /// <summary>
        /// API2.0 分销联盟用户子帐号ID
        /// </summary>
        public static string SubAllianceID = ConfigurationManager.AppSettings["SubAllianceID"] == null ? "" : ConfigurationManager.AppSettings["SubAllianceID"];
        /// <summary>
        /// 是否启用调试状态，调试状态会记录Trace
        /// </summary>
        public static bool IsDeBug = ConfigurationManager.AppSettings["IsDeBug"] == null ? true : ConfigurationManager.AppSettings["IsDeBug"] == "T";
        /// <summary>
        /// 售卖城市
        /// </summary>
        public static string SalesCity = ConfigurationManager.AppSettings["SalesCity"] == null ? null : ConfigurationManager.AppSettings["SalesCity"];
        /// <summary>
        /// 国际Aggregator产品渠道
        /// </summary>
        public static string ChannelIDType = ConfigurationManager.AppSettings["ChannelIDType"] == null ? "AirHotelIntl" : ConfigurationManager.AppSettings["ChannelIDType"];
        /// <summary>
        /// 国际Aggregator版本号
        /// </summary>
        public static string AggVersion = ConfigurationManager.AppSettings["AggVersion"] == null ? "1.0" : ConfigurationManager.AppSettings["AggVersion"];
        /// <summary>
        /// 国际Aggregator查询消息头类型
        /// </summary>
        public static string AggregatorMessageType = ConfigurationManager.AppSettings["AggregatorMessageType"] == null ? "FlightIntl.Aggregator.Search.SearchFlights" : ConfigurationManager.AppSettings["AggregatorMessageType"];

        /// <summary>
        /// 国际QTE查询
        /// </summary>
        public static string RepricingMessageType = ConfigurationManager.AppSettings["RepricingMessageType"] == null ? "FlightIntl.Booking.API.Repricing.WebService" : ConfigurationManager.AppSettings["RepricingMessageType"];

        /// <summary>
        /// 国际空位检查
        /// </summary>
        public static string FltIntlBookAbilityType = ConfigurationManager.AppSettings["FltIntlBookAbilityType"] == null ? "FlightIntl.Booking.API.BookAbility.WebService" : ConfigurationManager.AppSettings["RepricingMessageType"];

        /// <summary>
        /// 国际机票创建订单
        /// </summary>
        public static string FltIntlSaveOrderType = ConfigurationManager.AppSettings["FltIntlSaveOrderType"] == null ? "FlightIntl.Aggregator.Order.SubmitOrder" : ConfigurationManager.AppSettings["FltIntlSaveOrderType"];

        public static string FltFareRemarkType = ConfigurationManager.AppSettings["FltFareRemarkType"] == null ? "FlightIntl.Aggregator.FareRemark.Search" : ConfigurationManager.AppSettings["FltFareRemarkType"];

        /// <summary>
        /// 国内产品渠道
        /// </summary>
        public static string SalesType = (ConfigurationManager.AppSettings["SalesType"] == null) ? "AirHotelPackage" : ConfigurationManager.AppSettings["SalesType"];
        /// <summary>
        /// 国际产品渠道
        /// </summary>
        public static string IntlSalesType = (ConfigurationManager.AppSettings["IntlSalesType"] == null) ? "FHX" : ConfigurationManager.AppSettings["IntlSalesType"];

        public static string IntlFlightDefaultChannel = (ConfigurationManager.AppSettings["IntlFlightDefaultChannel"] == null) ? "Default" : ConfigurationManager.AppSettings["IntlFlightDefaultChannel"];
        public static string IntlFlightChannel = (ConfigurationManager.AppSettings["IntlFlightChannel"] == null) ? "SeatPackage" : ConfigurationManager.AppSettings["IntlFlightChannel"];
        /// <summary>
        /// BuyGroupCodes 
        /// </summary>
        public static string BuyGroupCodes = (ConfigurationManager.AppSettings["BuyGroupCodes"] == null) ? "AIRHOTELPACKAGE" : ConfigurationManager.AppSettings["BuyGroupCodes"];
        public static int FlightTopCount = (ConfigurationManager.AppSettings["FlightTopCount"] == null) ? 50 : Convert.ToInt32(ConfigurationManager.AppSettings["FlightTopCount"]);

        public static string DiscountInfo = (ConfigurationManager.AppSettings["DiscountInfo"] == null) ? @"1、您选择的是明折明扣机票，因网上数据更新有一定的延时，您所选定的航班、舱位和价格以操作人员回复为准。我们会尽快与您确认。2、选择本航班需使用信用卡支付" : ConfigurationManager.AppSettings["DiscountInfo"];

        /// <summary>
        /// 新版本城市IDS
        /// </summary>
        public static string CityIds = (ConfigurationManager.AppSettings["CityIds"] == null) ? "2" : ConfigurationManager.AppSettings["CityIds"];
        /// <summary>
        /// 新版本Uid
        /// </summary>
        public static string Uids = (ConfigurationManager.AppSettings["Uids"] == null) ? "wwwwww,E00012142,E00023284" : ConfigurationManager.AppSettings["Uids"];
        public static string DiscountInfo1 = (ConfigurationManager.AppSettings["DiscountInfo1"] == null) ? @"您选择的是明折明扣机票，因网上数据更新有一定的延时，您所选定的航班、舱位和价格以操作人员回复为准。我们会尽快与您确认。" : ConfigurationManager.AppSettings["DiscountInfo1"];
        public static string DiscountInfo2 = (ConfigurationManager.AppSettings["DiscountInfo2"] == null) ? @"选择本航班需使用信用卡支付" : ConfigurationManager.AppSettings["DiscountInfo2"];
        #endregion
        #region CancelOrder
        /// <summary>
        /// 获取待取消的数量
        /// </summary>
        public static string GetCancelOrdersCount = (ConfigurationManager.AppSettings["GetCancelOrdersCount"] == null) ? "200" : ConfigurationManager.AppSettings["GetCancelOrdersCount"];
        /// <summary>
        /// 获取删除临时订单的数量
        /// </summary>
        public static string DelPackageCount = (ConfigurationManager.AppSettings["DelPackageCount"] == null) ? "1000" : ConfigurationManager.AppSettings["DelPackageCount"];
        /// <summary>
        /// 取消下单时间至当前间隔(分钟)
        /// </summary>
        public static string CancelInterval = (ConfigurationManager.AppSettings["CancelInterval"] == null) ? "45" : ConfigurationManager.AppSettings["CancelInterval"];
        /// <summary>
        /// 失败尝试个数　默认是３
        /// </summary>
        public static string TryTimes = (ConfigurationManager.AppSettings["TryTimes"] == null) ? "3" : ConfigurationManager.AppSettings["TryTimes"];
        /// <summary>
        /// 错误表中取消间隔
        /// </summary>
        public static string CancelErrTryAgain = (ConfigurationManager.AppSettings["CancelErrTryAgain"] == null) ? "10" : ConfigurationManager.AppSettings["CancelErrTryAgain"];
        #endregion

        #region  book
        /// <summary>
        /// 支付方式 0信用卡 1现付
        /// </summary>
        public static string ChargeType = (ConfigurationManager.AppSettings["ChargeType"] == null) ? "0" : ConfigurationManager.AppSettings["ChargeType"];

        /// <summary>
        /// 信用卡支付
        /// </summary>
        public static int PaymentType = (ConfigurationManager.AppSettings["PaymentType"] == null) ? 32 : Convert.ToInt32(ConfigurationManager.AppSettings["PaymentType"]);
        /// <summary>
        /// Payment2.0
        /// </summary>
        public static int BillType = (ConfigurationManager.AppSettings["BillType"] == null) ? 1 : Convert.ToInt32(ConfigurationManager.AppSettings["BillType"]);
        /// <summary>
        /// 度假自由行
        /// </summary>
        public static string VBookingType = (ConfigurationManager.AppSettings["VBookingType"] == null) ? "PKG" : ConfigurationManager.AppSettings["VBookingType"];

        /// <summary>
        /// 度假自由行
        /// </summary>
        public static string VMobileBookingType = (ConfigurationManager.AppSettings["VMobileBookingType"] == null) ? "PHN" : ConfigurationManager.AppSettings["VMobileBookingType"];
        #endregion

        #region Hotel
        public static string VendorIDs = (ConfigurationManager.AppSettings["VendorIDs"] == null) ? "0" : ConfigurationManager.AppSettings["VendorIDs"];
        //public static int SubRoomReturnCount = (ConfigurationManager.AppSettings["SubRoomReturnCount"] == null) ? 1 : ConvertHelper.ConvertTo<int>(ConfigurationManager.AppSettings["SubRoomReturnCount"]);
        #endregion

        #region job Task
        public static int TaskCount = (ConfigurationManager.AppSettings["TaskCount"] == null) ? 10 : Convert.ToInt32(ConfigurationManager.AppSettings["TaskCount"]);
        #endregion

        #region memcached
        public static string FHXCache = (ConfigurationManager.AppSettings["FHXCache"] == null) ? "vacations_package" : ConfigurationManager.AppSettings["FHXCache"];
        #endregion

        #region PriceCalendar
        public static int AddDays = (ConfigurationManager.AppSettings["AddDays"] == null) ? 2 : Convert.ToInt32(ConfigurationManager.AppSettings["AddDays"]);
        public static int AddDaysPlus = (ConfigurationManager.AppSettings["AddDaysPlus"] == null) ? 33 : Convert.ToInt32(ConfigurationManager.AppSettings["AddDaysPlus"]);
        public static int MinTravelDay = (ConfigurationManager.AppSettings["MinTravelDay"] == null) ? 2 : Convert.ToInt32(ConfigurationManager.AppSettings["MinTravelDay"]);
        public static int MaxTravelDay = (ConfigurationManager.AppSettings["MaxTravelDay"] == null) ? 5 : Convert.ToInt32(ConfigurationManager.AppSettings["MaxTravelDay"]);
        public static int SearchDaysCount = (ConfigurationManager.AppSettings["SearchDaysCount"] == null) ? 30 : Convert.ToInt32(ConfigurationManager.AppSettings["SearchDaysCount"]);
        /// <summary>
        /// 获取删除FHX_PriceCalendarFlight的数量
        /// </summary>
        public static string DelFHX_PriceCalendarFlightCount = (ConfigurationManager.AppSettings["DelFHX_PriceCalendarFlightCount"] == null) ? "1000" : ConfigurationManager.AppSettings["DelFHX_PriceCalendarFlightCount"];
        /// <summary>
        /// 获取删除FHX_PriceCalendarHotel的数量
        /// </summary>
        public static string DelFHX_PriceCalendarHotelCount = (ConfigurationManager.AppSettings["DelFHX_PriceCalendarHotelCount"] == null) ? "1000" : ConfigurationManager.AppSettings["DelFHX_PriceCalendarHotelCount"];
        /// <summary>
        /// 获取删除FHX_PriceCalendarResult的数量
        /// </summary>
        public static string DelFHX_PriceCalendarResultCount = (ConfigurationManager.AppSettings["DelFHX_PriceCalendarResultCount"] == null) ? "1000" : ConfigurationManager.AppSettings["DelFHX_PriceCalendarResultCount"];
        /// <summary>
        /// 获取删除FHX_PriceCalendarTasks的数量
        /// </summary>
        public static string DelFHX_PriceCalendarTasksCount = (ConfigurationManager.AppSettings["DelFHX_PriceCalendarTasksCount"] == null) ? "1000" : ConfigurationManager.AppSettings["DelFHX_PriceCalendarTasksCount"];
        #endregion
        /// <summary>
        /// 查询版本号1000=OpenApi
        /// </summary>
        public const decimal SearchVersion_1000 = 1000;

        #region HotelPriceWeightRateLevel
        //public static decimal HotelPriceWeightRateLevel1 = (ConfigurationManager.AppSettings["HotelPriceWeightRateLevel1"] == null) ? 5 : ConvertHelper.ConvertTo<decimal>(ConfigurationManager.AppSettings["HotelPriceWeightRateLevel1"]);
        //public static decimal HotelPriceWeightRateLevel2 = (ConfigurationManager.AppSettings["HotelPriceWeightRateLevel2"] == null) ? 4 : ConvertHelper.ConvertTo<decimal>(ConfigurationManager.AppSettings["HotelPriceWeightRateLevel2"]);
        //public static decimal HotelPriceWeightRateLevel3 = (ConfigurationManager.AppSettings["HotelPriceWeightRateLevel3"] == null) ? 3 : ConvertHelper.ConvertTo<decimal>(ConfigurationManager.AppSettings["HotelPriceWeightRateLevel3"]);
        //public static decimal HotelPriceWeightRateLevel4 = (ConfigurationManager.AppSettings["HotelPriceWeightRateLevel4"] == null) ? 2 : ConvertHelper.ConvertTo<decimal>(ConfigurationManager.AppSettings["HotelPriceWeightRateLevel4"]);
        //public static decimal HotelPriceWeightRateLevel5 = (ConfigurationManager.AppSettings["HotelPriceWeightRateLevel5"] == null) ? 1 : ConvertHelper.ConvertTo<decimal>(ConfigurationManager.AppSettings["HotelPriceWeightRateLevel5"]);
        #endregion

        /// <summary>
        /// 国内机票创建订单
        /// </summary>
        public static string FltSaveOrderType = ConfigurationManager.AppSettings["FltSaveOrderType"] == null ? "Flight.Booking.Aggregator.SaveOrder" : ConfigurationManager.AppSettings["FltSaveOrderType"];
        /// <summary>
        /// 国内机票订单备注
        /// </summary>
        public static string OrderRemark = ConfigurationManager.AppSettings["OrderRemark"] == null ? "自由行订单号:" : ConfigurationManager.AppSettings["OrderRemark"];
        /// <summary>
        /// 国内渠道号
        /// </summary>
        public static string FltChannelID = ConfigurationManager.AppSettings["FltChannelID"] == null ? "AirHotelPackage" : ConfigurationManager.AppSettings["FltChannelID"];
        /// <summary>
        /// 测试帐号
        /// </summary>
        public static string TestUserID = ConfigurationManager.AppSettings["TestUserID"] == null ? "ctriptest;test111111;test1111;wwwwww" : ConfigurationManager.AppSettings["TestUserID"];
        public static string HotelFilterCityIds = (ConfigurationManager.AppSettings["HotelFilterCityIds"] == null) ? "" : ConfigurationManager.AppSettings["HotelFilterCityIds"];
        public static string FlightFilterCityCodes = (ConfigurationManager.AppSettings["FlightFilterCityCodes"] == null) ? "" : ConfigurationManager.AppSettings["FlightFilterCityCodes"];

        /// <summary>
        /// 国内openApi下单接入资源开放配置
        /// </summary>
        public static string FlightACityCodes = (ConfigurationManager.AppSettings["FlightACityCodes"] == null) ? "CKG,HRB,DLC,TAO,NKG" : ConfigurationManager.AppSettings["FlightACityCodes"];
        /// <summary>
        /// 国内openApi下单接入资源开发测试帐号
        /// </summary>
        public static string FlightOpenApiTestUserId = ConfigurationManager.AppSettings["FlightOpenApiTestUserId"] == null ? "wwwwww" : ConfigurationManager.AppSettings["FlightOpenApiTestUserId"];

        /// <summary>
        /// 赠送券目的城市及金额
        /// </summary>
        public static string GiveAmountACityCodes = ConfigurationManager.AppSettings["GiveAmountACityCodes"] == null ? "" : ConfigurationManager.AppSettings["GiveAmountACityCodes"];

    }
    #endregion
}
